import java.util.Properties;
import java.io.Serializable;

public class AccountRepresentation implements Serializable {
	boolean successful = false;
	String errorMessage = "";
	Properties updates = null;
	
	public boolean getSuccessful() {
		return successful;
	}
	
	public void setSuccessful(boolean result) {
		successful = result;
	}
	
	public void addErrorMessage(String message) {
		errorMessage += message;
	}
	
	public String getErrorMessages() {
		return errorMessage;
	}
	
	public boolean hasUpdates() {
		return (updates != null);
	}
	
	public void addUpdate(String key, String value) {
		if (updates == null) 
			updates = new Properties();
		updates.setProperty(key, value);
	}
	
	public Properties getUpdates() {
		return updates;
	}
	
	public void addUpdates(Properties props) {
		if (updates == null)
			updates = new Properties();
		updates.putAll(props);
	}

	public String toString() {
		String result = "";
		result += "Customer \n";
		result += "-------- \n";
		result += Constants.ACCOUNT_NUMBER + ":" + updates.getProperty(Constants.ACCOUNT_NUMBER) + "\n" ;
		result += Constants.NAME + ":" + updates.getProperty(Constants.NAME) + "\n" ;
		result += Constants.DOB + ":" + updates.getProperty(Constants.DOB) + "\n" ;
		result += Constants.SSN + ":" + updates.getProperty(Constants.SSN) + "\n" ;
		result += Constants.VOICEMAIL + ":" + updates.getProperty(Constants.VOICEMAIL) + "\n" ;
		result += Constants.CALLER_ID + ":" + updates.getProperty(Constants.CALLER_ID) + "\n" ;
		result += Constants.THREE_WAY + ":" + updates.getProperty(Constants.THREE_WAY) + "\n" ;
		result += Constants.DISTANCE_PROVIDER + ":" + updates.getProperty(Constants.DISTANCE_PROVIDER) + "\n" ;
				
		return result;
	}
}
